package acceptanceTests.promoteUser;

import acceptanceTests.registration.RegistrationInt;
import acceptanceTests.registration.RegistrationProxy;
import junit.framework.TestCase;

public class PromoteUserStoryTest extends TestCase {

	RegistrationInt _forumRegimp = new RegistrationProxy();
	PromoteUserInt _promoteimp = new PromoteUserProxy(_forumRegimp.getServer());
	public PromoteUserStoryTest(){
		super();
	}

	public void testPromote(){
		assertTrue(_forumRegimp.register("user1","abc@gmail.com","password1"));
		assertFalse(_promoteimp.isModerator("user1"));
		assertFalse(_promoteimp.isAdmin("user1"));
		assertTrue(_forumRegimp.register("user2","abc@gmail.com","password2"));
		assertFalse(_promoteimp.isModerator("user2"));
		assertFalse(_promoteimp.isAdmin("user2"));
		assertTrue(_promoteimp.Promote("user2","user1"));
		assertTrue(_promoteimp.Promote("user1","user2"));
		assertTrue(_promoteimp.isModerator("user1"));
		assertTrue(_promoteimp.isModerator("user2"));
		assertFalse(_promoteimp.isAdmin("user1"));
		assertFalse(_promoteimp.isAdmin("user2"));
		assertTrue(_promoteimp.Promote("user1","user2"));
		assertFalse(_promoteimp.isAdmin("user1"));
		assertTrue(_promoteimp.isAdmin("user2"));
		assertTrue( _forumRegimp.deleteRegisterUser("user1") );
		assertTrue( _forumRegimp.deleteRegisterUser("user2") );

	}

}
